package com.wd.jetpack.model;


/**
 * 接口请求返回Base类
 *
 * @param <T>
 */
public class BaseResponse<T> {
    private int code;
    private String msg;
    private boolean more;
    private boolean success;
    private T result;

    public T getData() {
        return result;
    }

    public void setData(T data) {
        this.result = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    //认证失败， 可认为是登录过期
    public boolean authEmpty() {
        return code == 20002;
    }

    //收银机未绑定
    public boolean unBind() {
        return code == 50116;
    }

    //绑定关系错误 登陆接口
    public boolean wrongBind(){
        return code == 50119;
    }

    //收银机类型错误
    public boolean deviceError() {
        return code == 50118;
    }

    //收银机不存在或类型错误
    public boolean postUnExist() {
        return code == 50117;
    }

    //绑定关系错误 登陆接口
    public boolean wrongBindByLogin(){
        return code == 50203;
    }
    //收银机未绑定 仅登录接口
    public boolean unBindByLogin() {
        return code == 50201;
    }

    //收银机不存在 仅登录接口
    public boolean unExistByLogin() {
        return code == 50202;
    }

    //添加支付行--流水号重复
    public boolean repeatFlow(){
        return code == 50120;
    }

    //订单已提交冲账 当前订单已申请售后
    public boolean hasCanceled(){
        return code == 50150;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean failed() {
        return code == 50001;
    }

    public boolean isMore() {
        return more;
    }

    public void setMore(boolean more) {
        this.more = more;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
